#pragma once 
#include<iostream>
#include<string>
#include<unistd.h>
class Task
{
public:
    Task()
    {}
    Task(int x,int y,char op):_x(x),_y(y),_op(op),_reslut(0),_exitcode(0)
    {}
    void operator()()
    {
        switch(_op)
        {
            case '+':
            _reslut=_x+_y;
            break;
            case '-':
            _reslut=_x-_y;
            break;
            case '*':
            _reslut=_x*_y;
            break;
            case '/':
            {
                if(_y==0) _exitcode=-1;
                else _reslut=_x/_y;
            }
            break;
             case '%':
            {
                if(_y==0) _exitcode=-1;
                else _reslut=_x%_y;
            }
            break;
            default:
            break;

        }
        usleep(10000);
    }
    std::string formatArg()
    {
        return std::to_string(_x)+_op+std::to_string(_y)+"=";
    }
    std::string formatRet()
    {
        return std::to_string(_reslut)+"("+std::to_string(_exitcode)+")";
    }
private:
    int _x;
    int _y;
    int _reslut;
    int _exitcode;
    char _op;
};

